/**
 * Copyright (C), 2015-2020, XXX有限公司
 * FileName: Person
 * Author:   ZX
 * Date:     2020/6/11 20:32
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package org.example.entity;

import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import lombok.Data;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * 〈一句话功能简述〉<br> 
 * 〈〉
 *
 * @author ZX
 * @create 2020/6/11
 * @since 1.0.0
 */
@Data
@TableName("t_person")
public class Person {
    @TableId(value = "id",type = IdType.AUTO)
    private int id;
    private String name;
    private Integer age;

    public Person() {
//        System.out.println("Person被创建了");
    }
    public Person(int id,String name) {
        this.id=id;
        this.name=name;
        System.out.println("Person被创建了");
    }

    public Person(int id, String name, int age) {
        this.id=id;
        this.name=name;
        this.age=age;
    }

    @PostConstruct
    public void eat(){
        System.out.println("Person created");
    }

    @Override
    public String toString() {
        return "Person{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    @PreDestroy
    public void say(){
        System.out.println("Person destroyed");
    }

}